home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.02 Feb 90 / Bit Mapper Source / BTMP2 / BitMapper_goodies.h next >
Encoding:
C/C++ Source or Header  |  1989-11-17  |  1.8 KB  |  79 lines  |  [TEXT/KAHL]

  1. /* ======================================= *
  2.     file:    BitMapper_goodies.h
  3.     date:    11.17.89
  4.  * --------------------------------------- *
  5.     Copyright © 1989, Michael Ogawa — All
  6.     Rights Reserved.
  7.  * ======================================= */
  8.  
  9. #ifndef _H_BitMapper_goodies
  10. #define _H_BitMapper_goodies
  11.  
  12. #ifdef applec
  13. #    include <Types.h>
  14. #    include <Memory.h>
  15. #    include <Errors.h>
  16. #endif applec
  17.  
  18. #ifdef THINK_C
  19. /* #define qDEBUG */
  20. #endif THINK_C
  21.  
  22.  
  23. /* constants ============================= */
  24.  
  25. #ifndef NULL    /* also defined in stdio.h */
  26. #    define NULL    0L
  27. #endif
  28.  
  29.  
  30. #define kBitsPerByte    8
  31. #define kBytesPerWord    2
  32. #define kBitsPerWord    \
  33.         (kBitsPerByte * kBytesPerWord)
  34. #define kWordsPerLWord    2
  35. #define kBytesPerLWord    \
  36.         (kBytesPerWord * kWordsPerLWord)
  37. #define kBitsPerLWord    \
  38.         (kBitsPerByte * kBytesLPerWord)
  39. /*    Generally useful equates of basic data
  40. element sizes.  One byte consists of eight
  41. bits (kBitsPerByte), one word consists of two
  42. bytes (kBytesPerWord), and one long word
  43. consists of two words (kWordsPerLWord) or
  44. four bytes (kBytesPerLWord).  There are 16
  45. bits in a word (kBitsPerWord), and 32 bits in
  46. a long word (kBitsPerLWord). */
  47. /*    m_o 09.17.89 */
  48.  
  49.  
  50. /* data types ============================ */
  51.  
  52. #ifdef THINK_C
  53. #define const    /* not yet implemented */
  54. #endif THINK_C
  55.  
  56.  
  57. /* macro-“functions” ===================== */
  58.  
  59. #define WIDTH(box)    \
  60.         (((box).right) - ((box).left))
  61. #define HEIGHT(box)    \
  62.         (((box).bottom) - ((box).top))
  63. /*    These macros return the width or height
  64. of the specified rectangle. */
  65. /*    m_o 07.17.89 */
  66.  
  67.  
  68. #define BITS2ROWBYTES(nBits)    \
  69.     ((((nBits) - 1) / kBitsPerWord + 1) \
  70.     * kBytesPerWord)
  71. /*    Converts the number of bits nBits to its
  72. equivalent number of rowBytes, making sure to
  73. account for the fact that rowBytes must be
  74. even. */
  75. /*    mps 07.17.89/m_o 09.17.89 */
  76.  
  77.  
  78. #endif _H_BitMapper_goodies
  79.